package com.shzg.im.model;

import java.sql.Date;
import java.text.SimpleDateFormat;

import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.format.annotation.DateTimeFormat.ISO;

public class Message {

    private String id;

    private String from_user_id;

    private String to_dest_id;

    private String message_content;

    @DateTimeFormat(iso = ISO.DATE_TIME)
    private Date send_time;

    private Date read_time;

    private int read_flag;

    private int message_type;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getFrom_user_id() {
        return from_user_id;
    }

    public void setFrom_user_id(String from_user_id) {
        this.from_user_id = from_user_id;
    }

    public String getTo_dest_id() {
        return to_dest_id;
    }

    public void setTo_dest_id(String to_dest_id) {
        this.to_dest_id = to_dest_id;
    }

    public String getMessage_content() {
        return message_content;
    }

    public void setMessage_content(String message_content) {
        this.message_content = message_content;
    }

    public Date getSend_time() {
        return send_time;
    }

    public void setSend_time(Date send_time) {
        this.send_time = send_time;
    }

    public Date getRead_time() {
        return read_time;
    }

    public void setRead_time(Date read_time) {
        this.read_time = read_time;
    }

    public int getRead_flag() {
        return read_flag;
    }

    public void setRead_flag(int read_flag) {
        this.read_flag = read_flag;
    }

    public int getMessage_type() {
        return message_type;
    }

    public void setMessage_type(int message_type) {
        this.message_type = message_type;
    }

    public SimpleDateFormat getSdf() {
        return sdf;
    }

    public void setSdf(SimpleDateFormat sdf) {
        this.sdf = sdf;
    }

    private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");

    @Override
    public String toString() {
        return String
                .format("Message [id=%s, fromUserId=%s, toDestId=%s, messageContent=%s, sendTime=%s, readTime=%s, readFlag=%s, messageType=%s]",
                        id, from_user_id, to_dest_id, message_content, sdf.format(send_time), read_time, read_flag,
                        message_type);
    }
}
